<template>
  <div>
    <el-table :data="tableData" style="width: 100%">
      <el-table-column prop="id" label="商家编号" width="180"></el-table-column>
      <el-table-column prop="goodsId" label="商家" width="180"></el-table-column>
      <el-table-column prop="orderId" label="订单编号" width="180"></el-table-column>
      <el-table-column prop="title" label="商家状态" width="180"></el-table-column>
<!--      <el-table-column prop="price" label="总价" width="180"></el-table-column>-->
      <el-table-column prop="num" label="创建日期" width="180"></el-table-column>
      <el-table-column prop="totalFee" label="总价" width="180"></el-table-column>
      <el-table-column prop="picPath" label="最后修改日期" width="180"></el-table-column>
      <el-table-column label="操作">
        <template slot-scope="scope">
          <el-button type="primary" circle @click="pay(scope.row)">支付</el-button>
        </template>
      </el-table-column>
    </el-table>
    <div class="block">
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="esVo.page"
        :page-sizes="[1, 3, 6, 9]"
        :page-size="esVo.size"
        layout="total, sizes, prev, pager, next, jumper"
        :total="esVo.total">
      </el-pagination>
    </div>
  </div>
</template>

<script>
    import axios from "axios";

    export default {
        name: "index",
      data(){
        return{
          tableData:[],
          esVo:{page:1,size:3,total:0}
        }
      },
      methods:{
        getCart(){
          var us= new FormData();
          us.append("page",this.esVo.page)
          us.append("size",this.esVo.size)
          us.append("total",this.esVo.total)
          axios.post("http://localhost:7000/shop/goods/goodsorderItem",this.esVo,us).then(res=>{
            console.log(us)
            console.log(res)
            this.esVo.total=res.data.data.total
            this.tableData=res.data.data
          })
        },
        handleSizeChange(val) {
          this.esVo.size=val
          console.log(`每页 ${val} 条`);
          this.getlist()
        },
        handleCurrentChange(val) {
          this.esVo.page=val
          console.log(`当前页: ${val}`);
          this.getlist()
        },
        pay(row){
          let obj={"orderId":row.orderId,"payment":row.payment,"goodsDesc":'花'}
          this.$router.push({path:'/shopping/orderForm', query:{"obj":obj}});
        },
      },
      mounted(){
        this.getCart();
      }
    }
</script>

<style scoped>

</style>
